package com.shop.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.shop.service.GoodsService;
import com.shop.service.impl.GoodsServiceImpl;
@WebServlet("/delGoods.do")
public class DelGoodsServlet extends HttpServlet{

	GoodsService goodsService = new GoodsServiceImpl();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		int goodsId;
		try {
			goodsId=Integer.parseInt(req.getParameter("goodsId"));
			goodsService.delGoodsId(goodsId);
			resp.sendRedirect("selectGoods.do");
		}catch(Exception e) {
			resp.sendRedirect("login.jsp");
		}

	}
}
